loadfile("lib/status.lua")()

function refuel()
	print("Place fuel in the first slot.")
	print("Press enter to stop refuelling ...")

	os.startTimer(1)
	while true do
		event, param1, param2, param3 = os.pullEvent()

		if event == "key" then
			if param1 == 28 then
				-- Enter key
				return
			end
		elseif event == "timer" then
			for i=1,16 do
				turtle.select(i)
				local hadFuel = false
				while turtle.refuel() do
					hadFuel = true
					print("New fuel level: "..turtle.getFuelLevel())
					os.sleep(0.25)
				end
				if not hadFuel then
					break
				end
			end
			os.startTimer(1)
		end
	end
end
	
if not statusLoad() then
	statusInit("refuel")
end

refuel()

statusEnd()
